﻿<Window x:Class="MissedMemo.MeatAndCheeseDisc.OrderMonitor.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:MissedMemo.MeatAndCheeseDisc.OrderMonitor"    
    Icon="/OrderMonitorUI;component/Resources/Application.ico"
    Title="(caption set at run time)"
    Height="640" Width="500">

    
    <Window.Resources>
        <ResourceDictionary>

            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="resOrderTemplates.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <Style x:Key="OrdersListBorderStyle" TargetType="Border" >
                <Setter Property="Background" Value="{StaticResource brushListBackground}" />
                <Setter Property="BorderBrush" Value="{StaticResource brushListBorder}" />
                <Setter Property="BorderThickness" Value="2" />
                <Setter Property="CornerRadius" Value="6" />
            </Style>

            <!-- Technique to hide ListBoxItem SELECTION border -->
            <Style TargetType="ListBoxItem">
                <Style.Resources>
                    <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/>
                    <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent"/>
                </Style.Resources>
            </Style>

        </ResourceDictionary>
    </Window.Resources>
    
    
    <Window.CommandBindings>
        <CommandBinding Command="{x:Static local:CustomCommands.CompleteOrderItem}" Executed="OnOrderItemCompleted" />
    </Window.CommandBindings>

    
    <Grid Background="{DynamicResource brushMainWindowBackground}" >
        
        <Border Margin="5" Style="{StaticResource OrdersListBorderStyle}" >
            <Grid DataContext="{x:Static local:App.PizzaOrders}" >

                <ListBox Name="listKitchenOrders" ItemsSource="{Binding}"
                     Background="Transparent" BorderThickness="0"
                     ItemTemplate="{StaticResource PizzaDataTemplate}"
                     ScrollViewer.HorizontalScrollBarVisibility="Disabled" >

                    <ListBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <WrapPanel/>
                        </ItemsPanelTemplate>
                    </ListBox.ItemsPanel>

                </ListBox>
                
                <!-- On-screen hint explains order item interaction -->
                
                <TextBlock Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center"
                           TextWrapping="Wrap" Name="labelHint" Text="Select an order to 'close' it" />
            </Grid>
        </Border>
    </Grid>
    
</Window>
